<?php
  session_cache_limiter('private,must-revalide');
   /**
   * 处理上传页面
   */ 
    include_once("../config.php");
    $id= $_POST['id'];	
	$cate_id = 0; //分类
	//date_default_timezone_set('Asia/Shanghai');	
	$time=date('Y-m-d H:i:s');
    /*$ch_headline =$_POST["ch_headline"];		//中文标题
    $search = "SELECT * FROM $TBL_NEWS WHERE ch_headline='$ch_headline' and id!=$id";
	$result = mysql_query( $search );
	if( @mysql_num_rows( $result ) > 0 )
	{
		MyNotice("該標題命名活動已存在,請換個標題試試！");
		exit();
	}
   	$ch_text = work_str($_POST["chinese_edit"], 1);				//中文内容	
	$ch_source= work_str($_POST['ch_source'],1);						//中文来源
	$en_headline = work_str($_POST["en_headline"], 1);			//英文标题
	$en_text = work_str($_POST["english_edit"], 1);					//中英内容
	$en_source = work_str($_POST["en_source"], 1);			    //英文来源
	$cont1 = array("<p>","</p>");
	$cont2 = array("","</br>");
	$ch_text1 = str_replace($cont1, $cont2, $ch_text);
	$en_text1 = str_replace($cont1, $cont2, $en_text);
	$sql_up="select * from $TBL_CATE where cate_id='$cate_id'";
	$result_up=mysql_query($sql_up);
	$row_up=mysql_fetch_array($result_up);
	$ch_cate_name = $row_up['zh_cate_title'];
	$en_cate_name = $row_up['en_cate_title'];	
	$user_id = $_SESSION['user_id'];
	*/
	$ch_text = work_str($_POST["chinese_edit"], 1);				//中文内容	
	$cont1 = array("<p>","</p>");
	$cont2 = array("","</br>");
	$text = str_replace($cont1, $cont2, $ch_text);
	$img = $_FILES['img']['name'];	
	$imgname = explode('.',$img);	
	$count = count($imgname)-1;
	$imgn = time().'.'.$imgname[$count];
	if($img!='')
	{
		$query = "UPDATE $TBL_DEAL SET text='$text',hou_id1='$imgn' where type=1";	
	}else{
		$query = "UPDATE $TBL_DEAL SET text='$text' where type=1";		
	}    
	//die($query);
    $res = mysql_query($query) or die(mysql_error());	
	if($_FILES['img']['name']!='')
	{
		$img_file =$conf['fck_upload'] . "adv";
		$file_full = $img_file."/".$imgn;
		$upload_file = $_FILES['img']['tmp_name'];          
		move_uploaded_file($upload_file, $file_full);       
	}
	
	MyNotice("生活情報圖片設置成功", 1, "../news.php");
	exit(0);  
  
?>